package com.muc.view.ext;

import javax.swing.table.DefaultTableModel;
import java.util.Vector;

public class MainViewTableModel  extends DefaultTableModel {
    static Vector<String> colums = new Vector<>();

    static {
        colums.addElement("车辆编号");
        colums.addElement("车辆型号");
        colums.addElement("车牌号");
        colums.addElement("车辆使用状态");
        colums.addElement("车辆日期");
//        colums.addElement("车辆归还日期");
        colums.addElement("租车价格");
        colums.addElement("车辆描述信息");
    }

    private MainViewTableModel() {
        super(null, colums);
    }

    private static MainViewTableModel mainViewTableModel = new MainViewTableModel();

    public static MainViewTableModel assembleModel(Vector<Vector<Object>> data) {
        mainViewTableModel.setDataVector(data, colums);
        return mainViewTableModel;
    }
    public static void updateModel(Vector<Vector<Object>> data) {
        mainViewTableModel.setDataVector(data, colums);
    }
    public static Vector<String> getColums() {
        return colums;
    }

    public static void setColums(Vector<String> colums) {
        mainViewTableModel.colums = colums;
    }

    @Override
    public boolean isCellEditable(int row, int column) {
        return false;
    }
}
